package com.fling.abcde.plugin;

import android.os.Bundle;
import androidx.annotation.CallSuper;
import android.view.View;

import java.io.Serializable;

/**
 * 类描述：基础插件类，所有插件都应继承此类
 * <p>
 * Created By FengLing
 */
public abstract class BasePluginActivity implements Serializable {

    private transient HostPluginActivity mHostActivity;

    final void setDelegate(HostPluginActivity activity) {

        mHostActivity = activity;
    }

    final public HostPluginActivity getHostActivity() {

        return mHostActivity;
    }

    public abstract void onCreate(Bundle savedInstanceState);

    @CallSuper
    public void setContentView(int layoutResID) {

        mHostActivity.setContentView(layoutResID);
    }

    public void onStart() {

    }

    public void onResume() {

    }

    public void onPause() {

    }

    public void onStop() {

    }

    public void onDestroy() {

        mHostActivity = null;
    }

    public <T extends View> T findViewById(int id) {

        return mHostActivity.findViewById(id);
    }

    public void onBaseRightClicked() {

    }

    public void onBaseLeftClicked() {

    }

    public void onClick(View v) {

    }

    public void onSaveInstanceState(Bundle outState) {

    }
}